import request from '@/config/axios'

// 党组织信息 VO
export interface OrganizationVO {
  id: number // 编号
  parentId: number // 上级组织编号
  name: string // 组织名称
}

// 党组织信息 API
export const OrganizationApi = {
  // 查询党组织信息分页
  getOrganizationPage: async (params: any) => {
    return await request.get({ url: `/pb/organization/page`, params })
  },

  // 查询党组织信息列表
  getOrganizationList: async () => {
    return await request.get<OrganizationVO[]>({ url: `/pb/organization/list` })
  },

  // 查询党组织信息详情
  getOrganization: async (id: number) => {
    return await request.get({ url: `/pb/organization/get?id=` + id })
  },

  // 新增党组织信息
  createOrganization: async (data: OrganizationVO) => {
    return await request.post({ url: `/pb/organization/create`, data })
  },

  // 修改党组织信息
  updateOrganization: async (data: OrganizationVO) => {
    return await request.put({ url: `/pb/organization/update`, data })
  },

  // 删除党组织信息
  deleteOrganization: async (id: number) => {
    return await request.delete({ url: `/pb/organization/delete?id=` + id })
  },

  // 导出党组织信息 Excel
  exportOrganization: async (params) => {
    return await request.download({ url: `/pb/organization/export-excel`, params })
  },
}
